package o;

import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.WeakHashMap;

public class yq {
    private boolean ˎ;
    private final Set<zm> ˏ = Collections.newSetFromMap(new WeakHashMap());
    private final List<zm> ॱ = new ArrayList();

    public void ॱ(@NonNull zm zmVar) {
        this.ˏ.add(zmVar);
        if (this.ˎ) {
            zmVar.ॱ();
            if (Log.isLoggable("RequestTracker", 2)) {
                Log.v("RequestTracker", "Paused, delaying request");
            }
            this.ॱ.add(zmVar);
            return;
        }
        zmVar.ˏ();
    }

    public boolean ˋ(@Nullable zm zmVar) {
        boolean z = true;
        if (zmVar != null) {
            boolean remove = this.ˏ.remove(zmVar);
            if (!(this.ॱ.remove(zmVar) || remove)) {
                z = false;
            }
            if (z) {
                zmVar.ॱ();
            }
        }
        return z;
    }

    public void ˎ() {
        this.ˎ = true;
        for (zm zmVar : aau.ˏ(this.ˏ)) {
            if (zmVar.ˋ()) {
                zmVar.ˊ();
                this.ॱ.add(zmVar);
            }
        }
    }

    public void ˏ() {
        this.ˎ = true;
        for (zm zmVar : aau.ˏ(this.ˏ)) {
            if (zmVar.ˋ() || zmVar.ˎ()) {
                zmVar.ॱ();
                this.ॱ.add(zmVar);
            }
        }
    }

    public void ˋ() {
        this.ˎ = false;
        for (zm zmVar : aau.ˏ(this.ˏ)) {
            if (!(zmVar.ˎ() || zmVar.ˋ())) {
                zmVar.ˏ();
            }
        }
        this.ॱ.clear();
    }

    public void ˊ() {
        for (zm ˋ : aau.ˏ(this.ˏ)) {
            ˋ(ˋ);
        }
        this.ॱ.clear();
    }

    public void ॱ() {
        for (zm zmVar : aau.ˏ(this.ˏ)) {
            if (!(zmVar.ˎ() || zmVar.ॱॱ())) {
                zmVar.ॱ();
                if (this.ˎ) {
                    this.ॱ.add(zmVar);
                } else {
                    zmVar.ˏ();
                }
            }
        }
    }

    public String toString() {
        return super.toString() + "{numRequests=" + this.ˏ.size() + ", isPaused=" + this.ˎ + "}";
    }
}
